Record redirect target in ParserOptions
[lhc/web/wiklou.git] / includes / parser / ParserOptions.php
index 2ca9d50..7e4059b 100644 (file)
@@ -211,6 +211,13 @@ class ParserOptions {
         */
        protected $onAccessCallback = null;
 
+       /**
+        * If the page being parsed is a redirect, this should hold the redirect
+        * target.
+        * @var Title|null
+        */
+       private $redirectTarget = null;
+
        public function getInterwikiMagic() {
                return $this->mInterwikiMagic;
        }
@@ -515,6 +522,30 @@ class ParserOptions {
                return wfSetVar( $this->mIsPrintable, $x );
        }
 
+       /**
+        * Set the redirect target.
+        *
+        * Note that setting or changing this does not *make* the page a redirect
+        * or change its target, it merely records the information for reference
+        * during the parse.
+        *
+        * @since 1.24
+        * @param Title|null $title
+        */
+       function setRedirectTarget( $title ) {
+               $this->redirectTarget = $title;
+       }
+
+       /**
+        * Get the previously-set redirect target.
+        *
+        * @since 1.24
+        * @return Title|null
+        */
+       function getRedirectTarget() {
+               return $this->redirectTarget;
+       }
+
        /**
         * Extra key that should be present in the parser cache key.
         * @param string $key